package com.jiwei.community.utils;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

/**
 * @author 季伟
 * @date 2024/4/15
 */
public class HtmlToPlainText {
    public static String htmlToPlainText(String html){
        Document document = Jsoup.parse(html);
        String plainText = document.text();
        return plainText;
    }

    public static void main(String[] args) {
        String html = "<a href=\\\"https://asvel.github.io/ffxiv-gearing/?klQ25iXJHeytBShMjGYHNDVg3LCPzJvr4YKLQ4YgEKJAemj\\\">外链</a><blockquote><p>这是引用</p></blockquote><img src=\\\"https://ff14risingstones.gcloud.com.cn/posts/20231219/10055642/c4905296cff2497ea231a402656f8fb0/1702965328213_e5c2ea961702965328213.png\\\" style=\\\"display: block; margin-left: auto; margin-right: auto;\\\">";
        String plainText = htmlToPlainText(html);
        System.out.println(plainText);
    }
}
